﻿'------------------------------
' Hien thi 5 tin moi nhat
'------------------------------
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Namespace NVPortal.Modules.NVTuyenDung

    Public MustInherit Class SettingCustomeDisplaySpecial
        Inherits DotNetNuke.Entities.Modules.ModuleSettingsBase


#Region "Event Handlers"
        Public Overrides Sub LoadSettings()
            Try
                If (Page.IsPostBack = False) Then

                    BindddlCategories()
                    BindDdlVitri()
                        'Het
                    If CType(ModuleSettings("NVTuyenDungCategorySetting"), String) <> "" Then
                        Me.ddlCategory.Items.FindByValue(ModuleSettings("NVTuyenDungCategorySetting")).Selected = True
                    End If
                    If CType(ModuleSettings("NVTuyenDungDisplayPageSetting"), String) <> "" Then
                        Me.txtDisplayNewsPage.Text = ModuleSettings("NVTuyenDungDisplayPageSetting")
                    End If
                    If CType(ModuleSettings("NVTuyenDungDisplayNumberSetting"), String) <> "" Then
                        Me.txtDisplayRow.Text = ModuleSettings("NVTuyenDungDisplayNumberSetting")
                    End If
                    If CType(ModuleSettings("NVTuyenDungDisplayStyleSetting"), String) <> "" Then
                        Me.ddlDisplayStyle.Items.FindByValue(ModuleSettings("NVTuyenDungDisplayStyleSetting")).Selected = True
                    End If
                    If CType(ModuleSettings("NVTuyenDungImageValueSetting"), String) <> "" Then
                        Me.txtImageWidth.Text = Split(ModuleSettings("NVTuyenDungImageValueSetting"))(0)
                        Me.txtImageHeight.Text = Split(ModuleSettings("NVTuyenDungImageValueSetting"))(1)
                    End If


                End If

            Catch exc As Exception    'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' UpdateSettings saves the modified settings to the Database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        '''		[cnurse]	10/22/2004	created
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Overrides Sub UpdateSettings()
            Try
                Dim objModules As New DotNetNuke.Entities.Modules.ModuleController
                objModules.UpdateModuleSetting(ModuleId, "NVTuyenDungCategorySetting", Me.ddlCategory.SelectedValue)
                If IsNumeric(Me.txtDisplayNewsPage.Text) Then
                    objModules.UpdateModuleSetting(ModuleId, "NVTuyenDungDisplayPageSetting", Me.txtDisplayNewsPage.Text)
                End If
                objModules.UpdateModuleSetting(ModuleId, "NVTuyenDungDisplayNumberSetting", IIf(Trim(Me.txtDisplayRow.Text) <> "", Trim(Me.txtDisplayRow.Text), "1"))
                objModules.UpdateModuleSetting(ModuleId, "NVTuyenDungDisplayStyleSetting", Me.ddlDisplayStyle.SelectedValue)
                objModules.UpdateModuleSetting(ModuleId, "NVTuyenDungImageValueSetting", IIf(Trim(Me.txtImageWidth.Text) <> "", Trim(Me.txtImageWidth.Text), "0") & " " & IIf(Trim(Me.txtImageHeight.Text) <> "", Trim(Me.txtImageHeight.Text), "0"))


            Catch exc As Exception    'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

        Private Sub BindddlCategories()
                Dim ctlNewsCategories As New NVTuyenDung_CongtyController
            Dim arrNewsCategories As New ArrayList
            arrNewsCategories = ctlNewsCategories.NV_TuyenDung_Cty_GetAll("11")
            Me.ddlCategory.DataSource = arrNewsCategories
            Me.ddlCategory.DataTextField = "Tencongty"
            Me.ddlCategory.DataValueField = "id"
            Me.ddlCategory.DataBind()
            Me.ddlCategory.Items.Insert(0, New ListItem("--Tất cả Công ty--", -1))

        End Sub
        Private Sub BindDdlVitri()
            Dim ctlStatus As New NVTuyenDung_VitriController
            Me.ddlVitri.DataSource = ctlStatus.GetAll(PortalId)
            Me.ddlVitri.DataTextField = "VitriTuyenDung"
            Me.ddlVitri.DataValueField = "Id"
            Me.ddlVitri.DataBind()
            Me.ddlVitri.Items.Insert(0, New ListItem("--Tất cả Vị trí--", -1))
        End Sub
#End Region


    End Class

End Namespace
